# calculate the cumulated number of wells and windfarms.


BEGIN {
  FS = ","
  OFS = ","
}

  


{
  if (NR == 1) {
    print $1, $2, $3, $4, $5,
    # "wfcount", "wcap", "cumucap"
    "wells","gas","oil","others","cumuwells"
    next
  }
  if ($2 == 2001 && $3 == 01) {
    cumucap[NR] = $6
    print $0, cumucap[NR]
    next
  }
  cumucap[NR] = $6 + cumucap[NR-1]

  print $0, cumucap[NR]

}

